private var hitParticles : ParticleEmitter;
var range = 100.0;


function Start(){
	
	hitParticles = GetComponentInChildren(ParticleEmitter);
	if(hitParticles){
		hitParticles.emit = false;
	}

}
function Update () {

    if (Input.GetMouseButtonDown(0)) {
		Debug.Log("Fired");
		fireShot();
	}
}

function fireShot(){
	var direction = transform.TransformDirection(Vector3.forward);
	var hit : RaycastHit;
	if (Physics.Raycast (transform.position, direction, hit, range)) {
            var otherObj : GameObject = hit.collider.gameObject;
			Debug.Log("Shot at: " + otherObj.tag);
			if (otherObj.tag == "Skeet"){
				var otherScript = otherObj.GetComponent(Die);
				otherScript.Die();
			}
			if (hitParticles) {
			hitParticles.transform.position = hit.point;
			hitParticles.transform.rotation = Quaternion.FromToRotation(Vector3.up, hit.normal);
			hitParticles.Emit();
			}
	}
}